import en from "@/lang/en";
import zhHans from "@/lang/zhHans";
const getters = {
  sgbList: (state) => (index, limit, page) => {
    const list = state.sgb.list.filter((i) => i.shijiIndex === index);
    return list.splice((page - 1) * limit, limit);
  },
  sgbType: (state) => state.sgb.type,
  imgUrl: (state) => state.imgUrl,
  langed: (state) => state.lang.langed,
  progressVal: (state) => state.progress.value,
  progressShow: (state) => state.progress.show,
  // 翻译方法
  t: (state) => (key) => {
    const { langed } = state.lang;
    const message = {
      en,
      zhHans,
    };
    return key;
    // const currentLang = message[langed];
    // return eval(`currentLang.${key}`);
  },
  // audio全局对象
  audio: (state) => state.audio.ad,
  analyser: (state) => state.audio.analyser,
  // 播放器全局视图对象
  playView: (state) => state.audio.view,
  // 播放器全局使用的icon
  playIconText: (state) => state.audio.iconText,
  // 底部列表
  bottomlist: (state) => state.bottomlist.bottomlist,
  currentLyric: (state) => state.audio.currentLyric,
  clyric: (state) => state.audio.lyric,
  settingLyricBtnShow: (state) => state.audio.settingLyricBtnShow,
  fingerprintId: (state) => state.login.user.fingerprintId,
  userId: (state) => state.login?.user?.userId,
  userInfo: (state) => state?.login?.user,
};
export default getters;
